/* IRReceive.h */
#ifndef IR_RECEIVE_H
#define IR_RECEIVE_H

#include <stdint.h>
#include "w55mh32_tim.h"
#include "w55mh32.h"

#define IR_RCC_APB2_PERIPH  RCC_APB2Periph_GPIOA
#define IR_PORT GPIOA
#define IR_PIN GPIO_Pin_0
#define IR_EXTI_LINE EXTI_Line0
#define IR_PORT_SOURCE GPIO_PortSourceGPIOA
#define IR_PIN_SOURCE GPIO_PinSource0
#define IR_NVIC_IRQ_Channel EXTI0_IRQn

#define IR_DATA_BUFFER_SIZE 400

#define IR_IDLE 0
#define IR_RECEIVING 1

#define tim4_irq_handler TIM4_IRQHandler
#define tim4 TIM4
#define reset RESET
#define exti0_irq_handler EXTI0_IRQHandler
#define enable ENABLE
#define tim4_irqn TIM4_IRQn

void ir_receive_config(void);

// 函数声明
void ir_receive_init(void);
uint8_t ir_get_data_count(void);
void ir_clear_data(void);
uint8_t ir_is_ready(void);
void ir_learn(void);
uint32_t get_32bit_timer_value(void);

#endif /* __IR_RECEIVE_H */
